﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NextCMS.Models;

/// <summary>
/// Summary description for WebadminBasePage
/// </summary>
public class WebadminBasePage : BasePage
{
    public int SiteId
    {
        get
        {
            return Convert.ToInt32(Session["SiteId"]);
        }
    }
    public string SiteName
    {
        get
        {
            return Session["SiteName"] == null ? CommonMethods.GetSiteName(SiteId) : Convert.ToString(Session["SiteName"]);
        }
    }
    public int LanguageId
    {
        get
        {
            return Convert.ToInt32(Session["LangId"]);
        }
    }
	public WebadminBasePage()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    protected override void OnInit(EventArgs e)
    {
        if (Session["Username"] == null)
            Response.Redirect("~/WebAdmin/WebAdminLogin.aspx");
        string[] strIgnore = { "ManageSites.aspx", "AddSite.aspx" };
        if (Session["SiteId"] == null && !strIgnore.Contains(Request.Url.Segments[Request.Url.Segments.Length-1]))
            Response.Redirect("~/WebAdmin/ManageSites.aspx");
        base.OnInit(e);
    }
}